/****************************************************
          File Name:shmctl.c
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Tue 16 Sep 2014 08:15:55 PM CST
*****************************************************/

#include<sys/types.h>
#include<sys/stat.h>
#include<stdio.h>
#include<sys/ipc.h>
#include<errno.h>
#include<stdlib.h>
#include<unistd.h>

void err(char *fun)
{
    perror(fun);
    exit(errno);
}

int main(int argc,char *argv[])
{
    int status;

    status=shmctl(atoi(argv[1]),IPC_RMID,NULL);
    if(status==-1)
        err("shmctl");

    exit(EXIT_SUCCESS);
}
